package com.guomao.function;

import java.util.function.Function;

public class FunctionDemo {

    public static void main(String[] args) {

        String num = "199";

        Integer result = functionString1(num, x -> Integer.parseInt(x));

        System.out.println(result + 100);

        functionString2(num, (x) -> {
            return Integer.parseInt(x) + 200;
        }, (y) -> y + "");

    }

    public static Integer functionString1(String str, Function<String, Integer> f) {
        return f.apply(str);
    }

    public static void functionString2(String str, Function<String, Integer> f1, Function<Integer, String> f2) {
        String string = f1.andThen(f2).apply(str);

        System.out.println(string+200);
    }

}
